<!-- 这就是一个vue的单文件组件 -->
<template>
    <h1>app.vue</h1>
    <ul>
        <!-- v-for="(value,index) in products" value就类似Foreach里面的value index就是数组下标-->
        <li v-for="(item,index) in products" v-bind:style="{backgroundColor:(index+1)%2==0?'gray':''}">
            编号{{index}}-{{item.id}}-{{item.name}}-{{item.price}}
        </li>
    </ul>
</template>
<script>
export default {
    data(){
        return {
            products:[
                {id:1,name:"Iphone",price:9999},
                {id:2,name:"华为",price:8999},
                {id:3,name:"小米",price:699},
                {id:4,name:"oppo",price:5999},
                {id:5,name:"vivo",price:3999},
            ]
        }
    }
}
</script>
<style>

</style>